From: Christian Hergert Date: Fri, 10 Jan 2020 23:00:10 +0000 (-0800) Subject: gtkmain: short-circuit gtk_main_sync() where no display X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1~1^2~321^2^2~355^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4a7f68e79e0c2a56eb1297e72a33cbdcd68418ba;p=gtk4.git gtkmain: short-circuit gtk_main_sync() where no display If there is no display, we will hit the slow path here which can introduce long latencies in unit tests. This checks for a NULL list of displays and simply short-circuits. --- diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index fe5868a95d..93fea8540a 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1081,6 +1081,9 @@ gtk_main_sync (void) /* Try storing all clipboard data we have */ displays = gdk_display_manager_list_displays (gdk_display_manager_get ()); + if (displays == NULL) + return; + cancel = g_cancellable_new (); for (l = displays; l; l = l->next)